5 ONERRORGOTO2000:DEFSEG=0 10 CLS:MODE8:DIM:ERASEa,b,d:DIMa(1,1),b(1,1),d(1,1):m=1:n=1:o=1:p=1:q=1:r=1:c$=CHR$(5):e=1 40 GOSUB460:GOSUB470:GOSUB420 50 LOCATE0,0:PRINTc$;"Matrix A";m$;":B";n$; 60 LOCATE28,1:z=ASC(INPUT$(1)):IFz>96 THENz=z-32 100 ONz-41 GOTO1250,1300,,1350,1500,,,,,,,,,,,,,,,,,,,120,130,700,800,,,,,800,,1400,1100,1150,,,300,,,,1200 110 GOTO60 120 x=m:GOTO500 130 x=o:GOTO600 300 LOCATE0,0:FORi=0 TOm:FORj=0 TOn:z=a(i,j):IFz<>0 ANDABSz>=1e-90 THENz=ROUND(z,LOG(ABSz)-7) 310 IFz<>0 ANDABSz<1e-90 THENz=z*1e10:z=ROUND(z,LOG(ABSz)-7):z=z/1e10 320 PRINTc$;"a(";MID$(STR$(i+1),2);",";MID$(STR$(j+1),2);") =";z; 330 z=ASC(INPUT$(1,@)):IFz=28 ORz=29 THEN50 340 IFz>96 THENz=z-32 350 ONz-41 GOTO1250,1300,,1350,1500,,,,,,,,,,,,,,,,,,,120,130,700,800,,,,,800,,1400,1100,1150,,,300,,,,1200 360 IFz<>13 ANDz<>31 ANDz<>30 THEN330 370 IF(z=31 ANDi+j=n+m) OR(z=30 ANDi+j=0) THEN330 390 IFz=30 THENIFj=0 THENi=i-1:j=n-1 ELSEj=j-2 400 NEXT:NEXT:GOTO50 420 CLS:PRINT:PRINT">A,B,D,I,T,K,+,-,*,M,L,C,P ?";:RETURN 440 FORi=0 TOm:FORj=0 TOn:a(i,j)=c(i,j):NEXT:NEXT:RETURN 460 n$="("+MID$(STR$(o+1),2)+","+MID$(STR$(p+1),2)+")":RETURN 470 m$="("+MID$(STR$(m+1),2)+","+MID$(STR$(n+1),2)+")":RETURN 480 m$="("+MID$(STR$(i+1),2)+","+MID$(STR$(j+1),2)+")":RETURN 500 i=x:j=n:GOSUB480:p$="A(m,n) = A"+m$:s$="m":z=x+1:GOSUB1900:IFw THEN40 ELSEx=z-1 510 i=x:j=n:GOSUB480:p$="A(m,n) = A"+m$:s$="n":z=n+1:GOSUB1900:IFw THEN500 520 m=x:n=z-1 530 DIMa(m,n) 540 FORi=0 TOm:FORj=0 TOn 550 p$="a("+MID$(STR$(i+1),2)+","+MID$(STR$(j+1),2)+")" 560 z=a(i,j):GOSUB1850:IFw=13 THENa(i,j)=z:GOTO580 570 IFj=0 THENIFi=0 THEN510 ELSEi=i-1:j=n-1 ELSEj=j-2 580 NEXT:NEXT:GOTO40 600 i=x:j=p:GOSUB480:p$="B(m,n) = B"+m$:s$="m":z=x+1:GOSUB1900:IFw THEN40 ELSEx=z-1 610 i=x:j=p:GOSUB480:p$="B(m,n) = B"+m$:s$="n":z=p+1:GOSUB1900:IFw THEN600 620 o=x:p=z-1 630 DIMb(o,p) 640 FORi=0 TOo:FORj=0 TOp 650 p$="b("+MID$(STR$(i+1),2)+","+MID$(STR$(j+1),2)+")" 660 z=b(i,j):GOSUB1850:IFw=13 THENb(i,j)=z:GOTO680 670 IFj=0 THENIFi=0 THEN610 ELSEi=i-1:j=n-1 ELSEj=j-2 680 NEXT:NEXT:GOTO40 700 LOCATE0,0:PRINTc$;"Change A";m$;"  B";n$;:IFm=o ANDn=p THEN750 710 ERASEc:DIMc(m,n):FORi=0 TOm:FORj=0 TOn:c(i,j)=a(i,j):NEXT:NEXT 720 ERASEa:DIMa(o,p):FORi=0 TOo:FORj=0 TOp:a(i,j)=b(i,j):NEXT:NEXT 730 ERASEb:DIMb(m,n):FORi=0 TOm:FORj=0 TOn:b(i,j)=c(i,j):NEXT:NEXT 740 x=m:y=n:m=o:n=p:o=x:p=y:z$=m$:m$=n$:n$=z$:GOTO50 750 FORi=0 TOm:FORj=0 TOn:w=a(i,j):a(i,j)=b(i,j):b(i,j)=w:NEXT:NEXT:GOTO50 800 LOCATE0,0:IFm<>n THENGOSUB1830:GOTO50 810 IFz=68 THENPRINTc$;"Determinant A = ....."; ELSEPRINTc$;"Inverse A  A"; 820 t=1E-10:d=1 830 ERASEc,e:y=2*(m+1)-1:x=m:DIMc(x,y),e(x) 840 FORi=0 TOm:FORj=0 TOn:c(i,j)=a(i,j):NEXT:NEXT 850 FORi=0 TOm:FORj=n+1 TOy:IFi=j-n-1 THENc(i,j)=1 860 NEXT:NEXT 870 FORi=0 TOx:e(i)=i:NEXT 880 FORk=0 TOx:w=ABS(c(k,k)):a=k:b=k 890 FORi=k TOx:FORj=k TOx:IFwa THENd=-d:FORj=k TOy:w=c(k,j):c(k,j)=c(a,j):c(a,j)=w:NEXT 950 IFk<>b THENd=-d:FORi=0 TOx:w=c(i,k):c(i,k)=c(i,b):c(i,b)=w:NEXT:w=e(k):e(k)=e(b):e(b)=w 960 w=c(k,k):d=d*w:c=k+1:FORj=c TOy:c(k,j)=c(k,j)/w:NEXT 970 FORi=0 TOx:IFi<>k THENw=c(i,k):FORj=c TOy:c(i,j)=c(i,j)-w*c(k,j):NEXT 980 NEXT:NEXT 1000 IFz=68 THENPRINTc$;"Determinant A =";STR$(d);:z$=INPUT$(1,@):GOTO50 1040 w=x+1:FORj=w TOy:FORi=0 TOx:w=e(i):c(w,x)=c(i,j):NEXT 1050 FORi=0 TOx:c(i,j)=c(i,x):NEXT:NEXT 1070 FORi=0 TOx:FORj=0 TOx:a(i,j)=c(i,j+x+1):NEXT:NEXT:GOTO300 1100 m=q:n=r:GOSUB470:LOCATE0,0:PRINTc$;"Load A  M";m$; 1110 ERASEa:DIMa(m,n):FORi=0 TOm:FORj=0 TOn:a(i,j)=d(i,j):NEXT:NEXT:GOTO50 1150 q=m:r=n:GOSUB470:LOCATE0,0:PRINTc$;"Memory A  M";m$; 1160 ERASEd:DIMd(q,r):FORi=0 TOm:FORj=0 TOn:d(i,j)=a(i,j):NEXT:NEXT:GOTO50 1200 w=m:m=n:n=w:GOSUB470:LOCATE0,0:PRINTc$;"Transpose A  A";m$; 1210 ERASEc:DIMc(m,n):FORi=0 TOn:FORj=0 TOm:c(j,i)=a(i,j):NEXT:NEXT 1220 ERASEa:DIMa(m,n):GOSUB440:GOTO300 1250 LOCATE0,0:IFn<>o THENGOSUB1830:GOTO50 1260 i=m:j=p:GOSUB480:PRINTc$;"A*B  A";m$; 1270 ERASEc:DIMc(m,p):FORi=0 TOm:FORj=0 TOp:w=0:FORk=0 TOn:w=w+a(i,k)*b(k,j):NEXT:c(i,j)=w:NEXT:NEXT:IFm<>o OR n<>p THENn=p:ERASEa:DIMa(m,n) 1280 GOSUB440:GOTO300 1300 LOCATE0,0:IFm<>o ORn<>p THENGOSUB1830:GOTO50 1310 PRINTc$;"A+B  A";m$; 1320 ERASEc:DIMc(m,n):FORi=0 TOm:FORj=0 TOn:c(i,j)=a(i,j)+b(i,j):NEXT:NEXT:GOSUB440:GOTO300 1350 LOCATE0,0:IFm<>o ORn<>p THENGOSUB1830:GOTO50 1360 PRINTc$;"A-B  A";m$; 1370 ERASEc:DIMc(m,n):FORi=0 TOm:FORj=0 TOn:c(i,j)=a(i,j)-b(i,j):NEXT:NEXT:GOSUB440:GOTO300 1400 p$="k*A"+m$+"  A":z=e:GOSUB1950:GOSUB420:IFw THEN50 ELSEe=z 1410 LOCATE0,0:PRINTp$; 1420 ERASEc:DIMc(m,n):FORi=0 TOm:FORj=0 TOn:c(i,j)=e*a(i,j):NEXT:NEXT:GOSUB440:GOTO300 1500 DEFCHR$(254)="0080F08000":CLS:GOSUB1600:i=2 1510 PRINT:ONi GOSUB1600,1610,1620,1630,1640,1650,1660,1670,1680,1690,1700,1710,1720 1520 z=ASC(INPUT$(1,@)):IFz=28 ORz=29 THEN1580 1530 IFz<>13 ANDz<>31 ANDz<>30 THEN1520 1540 IF(z=31 ANDi=13) OR(z=30 ANDi=1) THEN1520 1550 IFz=30 THENi=i-2 1570 i=i+1:IFi<14 THEN1510 1580 GOSUB420:GOTO50 1600 PRINT" A : input A(m,n)";:RETURN 1610 PRINT" B : input B(m,n)";:RETURN 1620 PRINT" D : determinant A";:RETURN 1630 PRINT" I : inverse Až  A";:RETURN 1640 PRINT" T : transposition A“  A";:RETURN 1650 PRINT" K : scalar-cal k*A  A";:RETURN 1660 PRINT" + : addition A+B  A";:RETURN 1670 PRINT" - : subtraction A-B  A";:RETURN 1680 PRINT" * : multiplication A*B  A";:RETURN 1690 PRINT" M : memory A  M";:RETURN 1700 PRINT" L : load A  M";:RETURN 1710 PRINT" C : change A  B";:RETURN 1720 PRINT" P : print A(m,n)";:RETURN 1830 LOCATE0,0:PRINTc$;"not found";:z$=INPUT$(1,@):RETURN 1850 CLS:PRINTp$;" =";z; 1860 LOCATE0,1:PRINTc$;"?";:INPUT@16;z:LOCATE0,0:w=PEEK(&H65B):RETURN 1900 CLS:PRINTp$; 1910 LOCATE0,1:PRINTc$;s$;" ?";:INPUT@3;z:LOCATE0,0:w=PEEK(&H65B)-13:IFw THENRETURN 1920 IFz<1 ORz>10 ORFRAC(z)<>0 THEN1910 ELSERETURN 1950 CLS:PRINTp$; 1960 LOCATE0,1:PRINTc$;"k=";z;"?";:INPUT@12;z:LOCATE0,0:w=PEEK(&H65B)-13:RETURN 2000 IFERR=1 THENCLS:ONERRORGOTO0 2010 IFERL=1860 THENRESUME1860 2020 IFERL=1910 THENRESUME1910 2030 IFERL=1960 THENRESUME1960 2040 IFERL=530 THENERASEa:RESUME530 2050 IFERL=630 THENERASEb:RESUME630 2080 GOSUB1830:RESUME40